<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>definepropety</title>

</head>
<body>
    <script>
        let data = {
            a:10,
            b:20
        }
        Object.defineProperty(data,'a',{
            get(){
                return val;
            },
            set(newValue){
                // console.log(newValue)
                val = newValue;
            }
        })
        data.a = 1000
        console.log(data);
    </script>
</body>
</html>